package org.example.musicserver.controller;

import jakarta.annotation.Resource;
import org.example.musicserver.common.Result;
import org.example.musicserver.service.CollectService;
import org.springframework.web.bind.annotation.*;

@RestController
public class CollectController {

    @Resource
    private CollectService collectService;
    // 添加收藏的歌曲
    //前台界面逻辑
    @PostMapping("/collection/add")
    public Result addSongCollection(@RequestParam Integer userId, @RequestParam Integer likeId,@RequestParam Byte type) {
        return collectService.addSongCollection(userId, likeId,type);
    }

    // 取消收藏的歌曲
    @DeleteMapping("/collection/delete")
    public Result deleteSongCollection(@RequestParam Integer userId, @RequestParam Integer likeId,@RequestParam Byte type) {
        return collectService.deleteSongCollect(userId, likeId, type);
    }

    // 返回的指定用户 ID 收藏的列表
    @GetMapping("/collection/detail")
    public Result collectionSongOfUser(@RequestParam Integer userId,@RequestParam Byte type) {
        return collectService.collectionSongOfUser(userId,type);
    }
    //返回指定用户id收藏的所有歌曲信息
    @GetMapping("/collection/detailSong")
    public Result collectionSongDetailOfUser(@RequestParam Integer userId,@RequestParam Byte type) {
        return collectService.collectionSongDetailOfUser(userId,type);
    }
}
